/*
 * Created on 13 avr. 2005
 *
 */
package communication.pack;

import objects.Station;

/**
 * @author Equipe SimPack 2005
 * a RouteRequest is sent in the network by a station when the sation wants to communicate
 * with a station which isn't in its routing table
 *  
 */
public class RouteRequest extends SMPackage{
	
    Station  requestedDestination; 
    //numero de sequence de la destination
    int destSequenceNo; 
    
    
    
    /**
     * constructor of an RouteRequest
     * @param r the Station
     * @param requestDest the destination requested
     * @param sn the sequence number
     * @param sc the Hop count
     * @param ri request number
     * @param ds the destination sequence number
     * @param t the package lifespan
     */
    public RouteRequest(Station r,Station requestDest,int sn, int sc, int ri,int ds, int t){
	super(r,sn, sc, ri, ROUTEREQUESTSIZE, t);
	destSequenceNo = ds;
	requestedDestination = requestDest;
	
    }
   
    /**
     * 
     * @param r
     */
    public RouteRequest(RouteRequest r){
	super(r);
	this.destSequenceNo=r.getDestinationSequenceNo();
	this.requestedDestination=r.getRequestedDestination();
    }
    
    /**
     * function toString
     */
    public String toString(){
	
	String s = this.infoPackage();
	String paquet = " paquet : ROUTE REQUEST \n " + s +
	    "\n mobile recherche : " + requestedDestination.getName()+
	    " \n num dest seq : " + destSequenceNo;
	return paquet;
    }
    
    
    /**
     * @return the requested station sequence number
     */
    public int getDestinationSequenceNo() {
	return destSequenceNo;
    }
    
    /**
     * @param i
     */
    public void setDestinationSequenceNo(int i) {
	destSequenceNo = i;
    }
    
    
    /** 
     * @return the requested destination
     */
    public Station getRequestedDestination(){
	return this.requestedDestination;
    }
    
}
